{% if isBuyFillUserinfo|default(false) %}
  {% if userinfoFieldsSetting %}
    {% if showNavTip|default(true) %}
      <div class="help-block">{{'温情提示：如果您的资料有变更，请在此修改，以便更好的为您服务！'|trans}}</div>
      <hr>
    {% endif %}

    {% for field in userinfoFieldsSetting %}
      {% set defaultFields = dict('userInfoFields') %}
      {% if field == 'truename' %}
        <div class="form-group">
          <label class="col-sm-3 control-label" for="truename">{{ defaultFields.truename }}</label>
          <div class="col-sm-6 controls">
            {% if app.user.approvalStatus == 'approved' and user.truename %}
              <div class="control-text">{{ user.truename }} <small class="text-success">({{'已认证'|trans}})</small></div>
            {% elseif app.user.approvalStatus == 'approving' and user.truename %}
              <div class="control-text">{{ user.truename }} <small class="text-warning">({{'实名认证中'|trans}})</small></div>
            {% else %}
              <input class="form-control" id="truename" type="text" name="truename" value="{{ user.truename }}">
            {% endif %}
          </div>
        </div>
      {% endif %}

      {% if field == 'email' %}
        <div class="form-group">
          <label class="col-sm-3 control-label" for="email">{{ defaultFields.email }}</label>
          <div class="col-sm-6 controls">
            {% set emailArr = app.user.email|split('@') %}
            {% if emailArr[1] != 'edusoho.net' %}
              <div class="control-text">{{ app.user.email }}</div>
            {% else %}
              <input class="form-control" id="email" type="text" name="email" value="" data-url="{{ path('register_email_check') }}" />
            {% endif %}
          </div>
        </div>
      {% endif %}

      {% if field == 'mobile' %}
        <div class="form-group">
          <label class="col-sm-3 control-label" for="mobile">{{ defaultFields.mobile }}</label>
          <div class="col-sm-6 controls">
            {% if app.user.verifiedMobile|default('') %}
              <div class="control-text">{{ blur_phone_number(app.user.verifiedMobile) }}<small class="text-success">({{'已绑定'|trans}})</small></div>
            {% else %}
              <input class="form-control" id="mobile" type="text" name="mobile" value="{{ user.mobile }}" data-url="{{ path('register_mobile_check') }}">
            {% endif %}
          </div>
        </div>
      {% endif %}

      {% if field == 'qq' %}
        <div class="form-group">
          <label class="col-sm-3 control-label" for="qq">{{ defaultFields.qq }}</label>
          <div class="col-sm-6 controls">
            <input class="form-control" id="qq" type="text" name="qq" value="{{ user.qq }}">
          </div>
        </div>
      {% endif %}

      {% if field == 'company' %}
        <div class="form-group">
          <label class="col-sm-3 control-label" for="company">{{ defaultFields.company }}</label>
          <div class="col-sm-6 controls">
            <input class="form-control" id="company" type="text" name="company" value="{{ user.company }}">
          </div>
        </div>
      {% endif %}

      {% if field == 'job' %}
        <div class="form-group">
          <label class="col-sm-3 control-label" for="job">{{ defaultFields.job }}</label>
          <div class="col-sm-6 controls">
            <input class="form-control" id="job" type="text" name="job" value="{{ user.job }}">
          </div>
        </div>
      {% endif %}

      {% if field == 'idcard' %}
        <div class="form-group">
          <label class="col-sm-3 control-label required" for="idcard">{{ defaultFields.idcard }}</label>
          <div class="col-sm-6 controls">
            {% if app.user.approvalStatus == 'approved' and user.idcard %}
              <div class="control-text">{{ blur_idcard_number(user.idcard) }} <small class="text-success">({{'已认证'|trans}})</small></div>
            {% elseif app.user.approvalStatus == 'approving' and user.idcard %}
              <div class="control-text">{{ blur_idcard_number(user.idcard) }} <small class="text-warning">({{'实名认证中'|trans}})</small></div>
            {% else %}
              <input type="text" id="idcard" name="{{ field }}"  class="form-control" value="{{user.idcard}}">
            {% endif %}
          </div>
        </div>
      {% endif %}

      {% if field == 'gender' %}
        <div class="form-group">
          <label class="col-sm-3 control-label required" for="gender">{{ defaultFields.gender }}</label>
          <div class="col-sm-6">
            <div class="checkbox-inline" style="padding-left: 0">
              <input type="radio" id="gender_0" name="gender" value="male" {% if user.gender=="male"%}checked=true{% endif %}>
              <span for="profile_gender_0" class="required mrl">{{'男'|trans}}</span>
              <input type="radio" id="gender_1" name="gender" value="female"  {% if user.gender=="female"%}checked=true{% endif %}>
              <span for="profile_gender_1" class="required" >{{'女'|trans}}</span>
            </div>
          </div>
        </div>
      {% endif %}

      {% if field == 'weixin' %}
        <div class="form-group">
          <label class="col-sm-3 control-label required" for="weixin">{{ defaultFields.weixin }}</label>
          <div class="col-sm-6 controls">
            <input type="text" id="weixin" name="{{ field }}"  class="form-control" value="{{user.weixin}}">
          </div>
        </div>
      {% endif %}

      {% if field == 'weibo' %}
        <div class="form-group">
          <label class="col-sm-3 control-label required" for="weibo">{{ defaultFields.weibo }}</label>
          <div class="col-sm-6 controls">
            <input type="text" id="weibo" name="{{ field }}"  class="form-control" value="{{user.weibo}}">
          </div>
        </div>
      {% endif %}

      {% for userField in userFields %}
        {% if field == userField.fieldName %}
           {% if userField.type=="text" %}
              <div class="form-group">
                <label for="{{userField.fieldName}}" class="col-sm-3 control-label ">{{userField.title}}</label>
                <div class="col-sm-6 controls">
                  <textarea id="{{userField.fieldName}}" name="{{userField.fieldName}}" class="form-control ">{{ user[userField.fieldName]|default('') }}</textarea>
                  <div class="help-block" style="display:none;"></div>
                </div>
              </div>

            {% elseif userField.type=="int" %}
              <div class="form-group">
                <label for="{{userField.fieldName}}" class="col-sm-3 control-label">{{userField.title}}</label>
                <div class="col-sm-6 controls">
                  <input type="text" id="{{userField.fieldName}}" placeholder="{{'最大值为9位整数'|trans}}" name="{{userField.fieldName}}" class="{{userField.type}}  form-control" data-widget-cid="widget-5" data-explain="" value="{{ user[userField.fieldName]|default('') }}">
                  <div class="help-block" style="display:none;"></div>
                </div>
              </div>

            {% elseif userField.type=="float" %}
              <div class="form-group">
                <label for="{{userField.fieldName}}" class="col-sm-3 control-label">{{userField.title}}</label>
                <div class=" col-sm-6 controls">
                  <input type="text" id="{{userField.fieldName}}" placeholder="{{'保留到2位小数'|trans}}" name="{{userField.fieldName}}" class="{{userField.type}} form-control" data-widget-cid="widget-5" data-explain="" value="{{ user[userField.fieldName]|default('') }}">
                  <div class="help-block" style="display:none;"></div>
                </div>
              </div>

            {% elseif userField.type=="date" %}
              <div class="form-group">
                <label for="{{userField.fieldName}}" class="col-sm-3 control-label">{{userField.title}}</label>
                <div class=" col-sm-6 controls">
                  <input type="text" id="{{userField.fieldName}}" name="{{userField.fieldName}}" class="{{userField.type}}  form-control" data-widget-cid="widget-5" data-explain="" value="{{ user[userField.fieldName]|default('') }}">
                  <div class="help-block" style="display:none;"></div>
                </div>
              </div>

            {% elseif userField.type=="varchar" %}
              <div class="form-group">
                <label for="{{userField.fieldName}}" class="col-sm-3 control-label">{{userField.title}}</label>
                <div class="col-sm-6  controls">
                  <input type="text" id="{{userField.fieldName}}" name="{{userField.fieldName}}" class="form-control" data-widget-cid="widget-5" data-explain="" value="{{ user[userField.fieldName]|default('') }}">
                  <div class="help-block" style="display:none;"></div>
                </div>
              </div>
            {% endif %}

          {% endif %}
        {% endfor %}
      {% endfor %}
    {% endif %}
{% endif %}

